Specifying How Your Driver Communicates With the Device
You need to specify how your printer driver communicates with the physical printing device that it is driving. You do this with two resource types: the communications ('comm'
) resource and the buffering and input/output preferences ('iobm'
) resource, known simply as the buffering resource. Each communications resource specifies the parameters for a particular kind of printing-device communications, as described in the section "The Communications ('comm') Resource" beginning on page 6-36 in the chapter "Printing Resources." The buffering resource, which is described on page 6-61 in the chapter "Printing Resources," specifies buffer size and timing parameters.There are different kinds of communications resources--one for each kind of printing-device communications that QuickDraw GX supports. Each of these resource types has its own format. Listing 3-22 shows the communications resources that are defined for the ImageWriter II printer driver, which supports PAP, serial, and PrinterShare communications connections.
Listing 3-22 Communications resources for the ImageWriter II printer driver
resource 'comm' (-4096, sysHeap, purgeable) { PAP { 1, /* flow quantum */ "", /* AppleTalk address (filled in by Chooser) */ 0, 0, 0, 0 }; }; resource 'comm' (-4095, sysHeap, purgeable) { Serial { baud9600, /* output baud rate */ noParity, /* output parity */ oneStop, /* output stop bits */ data8, /* output data size */ 0x00010000, /* output handshaking */ 0x00000000, baud9600, /* input baud rate */ noParity, /* input parity */ oneStop, /* input stop bits */ data8, /* input data bits */ 0, /* input handshaking */ 0, 1024, /* input buffer size */ ".AIn", /* input driver name;filled in by Chooser */ ".AOut" /* output driver name; filled in by Chooser*/ }; }; resource 'comm' (-4094, sysHeap, purgeable) { PrinterShare { "", /* AppleTalk address, filled in by Chooser */ 0 }; };You use the buffering resource to control the size of the buffers that your driver uses
to communicate with the printing device. You also specify timeout values for your communications requests in this resource. Listing 3-23 shows the buffering resource
that the ImageWriter II printer driver uses.Listing 3-23 The buffering and input/output preferences resource for the ImageWriter II printer driver
resource gxUniversalIOPrefsType (gxUniversalIOPrefsID, sysHeap, purgeable) { standardIO, 4, /* 4 buffers */ 2048, /* 2 KB each (enough for 1 scan line of data) */ 10, /* up to 10 I/O operations pending */ 1200, /* open/close timeout of 1200 clock ticks */ 1200 /* read/write timeout of 1200 clock ticks */ };
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help